From 6f789132c529933f76b84b9de1d137bda6dd90f1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 11 Aug 2008 19:59:50 +0000 Subject: [PATCH] Fix build with old cups svn path=/trunk/; revision=21079 --- ChangeLog | 8 ++++++++ modules/printbackends/cups/gtkcupsutils.c | 10 ++++++++++ modules/printbackends/cups/gtkcupsutils.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4da2de8af3..3d68b26e40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-08-11 Matthias Clasen + + Bug 546616 – CUPS print backend uses 1.2 API without guards + + * modules/printbackends/cups/gtkcupsutils.[hc]: Make use + of cups 1.2 api dependent on the HAVE_CUPS_1_2 define. + Patch by Sven Herzberg and Richard Hult + 2008-08-11 Michael Natterer Bug 547270 – Make GtkHSV public diff --git a/modules/printbackends/cups/gtkcupsutils.c b/modules/printbackends/cups/gtkcupsutils.c index d11653b359..8abe8021e4 100644 --- a/modules/printbackends/cups/gtkcupsutils.c +++ b/modules/printbackends/cups/gtkcupsutils.c @@ -1204,6 +1204,7 @@ GtkCupsConnectionTest * gtk_cups_connection_test_new (const char *server) { GtkCupsConnectionTest *result = NULL; +#ifdef HAVE_CUPS_API_1_2 gchar *port_str = NULL; result = g_new (GtkCupsConnectionTest, 1); @@ -1222,6 +1223,9 @@ gtk_cups_connection_test_new (const char *server) result->success_at_init = FALSE; result->success_at_init = gtk_cups_connection_test_is_server_available (result); +#else + result = g_new (GtkCupsConnectionTest, 1); +#endif return result; } @@ -1235,6 +1239,7 @@ gtk_cups_connection_test_new (const char *server) gboolean gtk_cups_connection_test_is_server_available (GtkCupsConnectionTest *test) { +#ifdef HAVE_CUPS_API_1_2 http_addrlist_t *iter; gboolean result = FALSE; gint flags; @@ -1295,6 +1300,9 @@ gtk_cups_connection_test_is_server_available (GtkCupsConnectionTest *test) return result; } +#else + return TRUE; +#endif } /* This function frees memory used by the GtkCupsConnectionTest structure. @@ -1305,6 +1313,7 @@ gtk_cups_connection_test_free (GtkCupsConnectionTest *test) if (test == NULL) return; +#ifdef HAVE_CUPS_API_1_2 test->current_addr = NULL; httpAddrFreeList (test->addrlist); if (test->socket != -1) @@ -1312,5 +1321,6 @@ gtk_cups_connection_test_free (GtkCupsConnectionTest *test) close (test->socket); test->socket = -1; } +#endif g_free (test); } diff --git a/modules/printbackends/cups/gtkcupsutils.h b/modules/printbackends/cups/gtkcupsutils.h index 7dfe387f91..a6314bb8a5 100644 --- a/modules/printbackends/cups/gtkcupsutils.h +++ b/modules/printbackends/cups/gtkcupsutils.h @@ -83,10 +83,12 @@ struct _GtkCupsRequest struct _GtkCupsConnectionTest { +#ifdef HAVE_CUPS_API_1_2 http_addrlist_t *addrlist; http_addrlist_t *current_addr; gboolean success_at_init; gint socket; +#endif }; #define GTK_CUPS_REQUEST_START 0 -- 2.30.2